<?
#####################################################
#  COPYRIGHT NOTICE
#####################################################
# In the following statements, the term "this 
# program" refers to all files associated with the
# execution and distribution of Adtrackz.
#
# This Program is Copyright 2004 Jonah Klimack.
# All Rights Reserved. 
#
# Selling the code for this program, modifying 
# and/or redistributing the code for this program
# in part or in whole over the Internet or in any 
# other medium is expressly forbidden. Violators
# will be prosecuted to the fullest extent of the law
# Copyright and header information may not be
# modified.
#
# This program is distributed "as is" and without 
# warranty of any kind, either express or implied.
# In no event shall the liability of Jonah Klimack 
# for any damages, losses and/or causes of 
# action exceed the total amount paid by the 
# user for this software.		
#####################################################
# DO NOT MODIFY ANYTHING IN THIS FILE
#####################################################


require "config.php";

//track affiliate sales
if ($afftrack)
{	
	//globals
	$campaignID = mysql_fetch_row(mysql_query("select ID from adtrackz_campaigns where adcode='$c'"));
	if ($s)
		$subID = mysql_fetch_row(mysql_query("select ID from adtrackz_subcampaigns where adcode='$s' && campaignID='$campaignID[0]'"));
	$time=time();

	if ($type == "sale")
	{
		if (!preg_match("/\b\d+\.\d{2}\b/", $value))
		{
			record_alert("Revenue must be in $0.00 format in a.php");
			header("Location: http://$domain/$udirectory/1x1.gif");
			exit;
		}
		mysql_query("insert into adtrackz_sales values('','$campaignID[0]','$subID[0]',$time,'$value','$id','','$description')");
	}
	if ($type == "action")
	{
		mysql_query("insert into adtrackz_actions values('','$campaignID[0]','$subID[0]',$time,'$id','$name','$description')");
	}
	

}

header("Location: http://$domain/$udirectory/1x1.gif");
exit;

?>